@extends("admin::layouts.master")
@section("content")
{{--123--}}
{{--{{dd($role)}}--}}
    <form action="{{route('power',$id)}}" method="post">
    @csrf
    <div class="col-lg-12">
        <div class="card card-flat">
            <div class="card-header">分配[{{$role['title']}}]的权限</div>

            @foreach($permission as $v)

                @foreach($v['rules'] as $kk=>$vv)


            <div class="form-group row pt-1 pb-1">

            <div class="card-body">



                    <label  class="col-12 col-sm-3 col-form-label text-sm-right">{{$vv['group']}}</label>

                    <div style="display: inline" class="col-12 col-sm-8 col-lg-6 form-check mt-2">

                        @foreach($vv['permissions'] as $kkk=>$vvv)

                        <label class="custom-control custom-checkbox custom-control-inline">
                            {{--判断角色是否拥有某些权限--}}
                            <input type="checkbox" name="name[]" @if($role->hasPermissionTo($vvv['name']) ) checked @endif class="custom-control-input" value="{{$vvv['name']}}"><span class="custom-control-label">{{$vvv['title']}}</span>

                        </label>

                        @endforeach


                    </div>



                </div>


            </div>
                @endforeach
            @endforeach
            <a style="float: right" href="javascript:window.history.back()">返回上一级</a>

        </div>

        注意，这里不能使用a标签的原因，a标签跳转不能把内容带过去，但是form表单可以
        <a href="{{route('power' ,$id)}}" class="btn btn-success">确定分配</a>
        <button type="submit" class="btn btn-success">确定分配</button>


    </div>

    </form>

    @endsection